/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package domaci3.controller;

import domaci3.model.Kvadrat;
import domaci3.model.Pravougaonik;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author Ilija
 */
public class MojOsluskivac implements ActionListener{
    
    Controller c;
    
    MojOsluskivac (Controller c){
        this.c = c;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        boolean info = c.view.proveriPodatke();
        if (info == true){
            if (c.view.getJPanel1().isVisible()){
                System.out.println("test");
                Pravougaonik p = new Pravougaonik (c.view.parsiraj(c.view.getJTextField1().getText()), c.view.parsiraj(c.view.getJTextField2().getText()));
                c.lista.ubaci(p);
                System.out.println("uspelo");
            }
            if (c.view.getJPanel2().isVisible()){
                Kvadrat k = new Kvadrat (c.view.parsiraj(c.view.getJTextField3().getText()));
                c.lista.ubaci(k);
            }
        }
        c.view.vratiFormeNaNormalno();
    }
    
    
}
